<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix = "c"  uri = "http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" type="text/css"  href="css/bootstrap.min.css"/>
	<title>凯胜项目管理系统</title>
		<style type="text/css">
		body{
			padding-top:50px;
		}
	</style>
</head>
<body class="body">
	<c:choose>
		<c:when test="${empty requestScope.userProjectList.list}">
			<%@include file="same3.jsp" %>
		</c:when>
		<c:otherwise>
			<%@include file="same2.jsp" %>
		</c:otherwise>
	</c:choose>

	<div class="container" style="margin-left:140px;">
		<div class="row">
			<div class="span3"></div>
			<div class="span9">
				<div class="page-header"><h2>项目列表</h2></div>
				<c:choose>
					<c:when test="${empty requestScope.userProjectList.list}">
							<c:choose>
								<c:when test="${sessionScope.user.username!='admin'}">
									现在没有任何项目
								</c:when>
								<c:otherwise>
									<c:forEach items = "${requestScope.Plist.list }" var = "pro">
										 <ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:15px">
											<li class="active">
												<a href="#"><i class="icon-th"></i>${pro.name}</a>&nbsp;&nbsp;&nbsp;&nbsp;创建于${pro.createtime}
											</li>
										 </ul>
										 <div class="wall" style="border-top:none; border:1px solid #dddddd ">
											<p style="margin:15px">${pro.description}</p>
										</div>
									</c:forEach>
									<div style ="clear:both"></div>                                                                                                                                                                                                             	
									<div style="margin-top:10px;margin-right:50px"  class="pagination pull-right">
								 <ul>
								 
								<c:choose>
									<c:when test="${ requestScope.Plist.totalPage == 1}">
										
									</c:when>
									<c:when test="${ requestScope.Plist.totalPage > 1}">
										<c:choose>
										<c:when test="${Plist.pageNum == 1}">
											<li><a href="#">Prev</a></li>
											<li class = "active"><a>1</a></li>
											<li ><a href = "project.jspx?q=2">2</a></li>
											<li><a>...</a></li>	
											<li><a href="#">Next</a></li>			
										</c:when>
										<c:when test="${Plist.pageNum == 2}">
											<li><a href="project.jspx?q=${Plist.pageNum-1}">Prev</a></li>
											<li ><a href = "project.jspx?q=1">1</a></li>
											<li class = "active"><a href = "project.jspx?q=2">2</a></li>
											<li><a>...</a></li>
											<c:choose>
											<c:when test="${Plist.pageNum == Plist.totalPage }">
												<li><a href="#">Next</a></li>
											</c:when>
											<c:otherwise>
												<li><a href="project.jspx?q=${Plist.pageNum+1}">Next</a></li>
											</c:otherwise>
											</c:choose>				
										</c:when>	
										<c:when test="${Plist.pageNum > 2}">
											<li><a href="project.jspx?q=${Plist.pageNum-1}">Prev</a></li>
											<li ><a href = "project.jspx?q=1">1</a></li>
											<li ><a href = "project.jspx?q=2">2</a></li>
											<li><a>...</a></li>	
											<li class = "active"><a >${Plist.pageNum}</a></li>
											<c:choose>
											<c:when test="${Plist.pageNum == Plist.totalPage }">
												<li><a href="#">Next</a></li>
											</c:when>
											<c:otherwise>
												<li><a href="project.jspx?q=${Plist.pageNum+1}">Next</a></li>
											</c:otherwise>
											</c:choose>		
										</c:when>	
										</c:choose>	
									</c:when>
								</c:choose>	
								<li><a>共${Plist.totalPage}页</a></li>
								</ul></div>	
								</c:otherwise>
							</c:choose>
					</c:when>
					<c:otherwise>
						<c:forEach items = "${requestScope.userProjectList.list }" var = "userproject">
							 <ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:15px">
								<li class="active">
									<a href="project.jspx?method=enter&id=${userproject.project.id }"><i class="icon-th"></i>${userproject.project.name}</a>&nbsp;&nbsp;&nbsp;&nbsp;创建于${userproject.project.createtime}&nbsp;&nbsp;&nbsp;&nbsp;[${userproject.role}]
								</li>
							 </ul>
							 <div class="wall" style="border-top:none; border:1px solid #dddddd ">
								<p style="margin:15px">${userproject.project.description}</p>
							</div>
						</c:forEach>
						<div style ="clear:both"></div>                                                                                                                                                                                                             	
									<div style="margin-top:10px;margin-right:50px"  class="pagination pull-right">
								 <ul>
								 
								<c:choose>
									<c:when test="${ requestScope.userProjectList.totalPage == 1}">
										
									</c:when>
									<c:when test="${ requestScope.userProjectList.totalPage > 1}">
										<c:choose>
										<c:when test="${userProjectList.pageNum == 1}">
											<li><a href="#">Prev</a></li>
											<li class = "active"><a>1</a></li>
											<li ><a href = "project.jspx?p=2">2</a></li>
											<li><a>...</a></li>	
											<li><a href="#">Next</a></li>			
										</c:when>
										<c:when test="${userProjectList.pageNum == 2}">
											<li><a href="project.jspx?p=${userProjectList.pageNum-1}">Prev</a></li>
											<li ><a href = "project.jspx?p=1">1</a></li>
											<li class = "active"><a href = "project.jspx?p=2">2</a></li>
											<li><a>...</a></li>
											<c:choose>
											<c:when test="${userProjectList.pageNum == userProjectList.totalPage }">
												<li><a href="#">Next</a></li>
											</c:when>
											<c:otherwise>
												<li><a href="project.jspx?p=${userProjectList.pageNum+1}">Next</a></li>
											</c:otherwise>
											</c:choose>				
										</c:when>	
										<c:when test="${userProjectList.pageNum > 2}">
											<li><a href="project.jspx?p=${userProjectList.pageNum-1}">Prev</a></li>
											<li ><a href = "project.jspx?p=1">1</a></li>
											<li ><a href = "project.jspx?p=2">2</a></li>
											<li><a>...</a></li>	
											<li class = "active"><a >${userProjectList.pageNum}</a></li>
											<c:choose>
											<c:when test="${userProjectList.pageNum == userProjectList.totalPage }">
												<li><a href="#">Next</a></li>
											</c:when>
											<c:otherwise>
												<li><a href="project.jspx?p=${userProjectList.pageNum+1}">Next</a></li>
											</c:otherwise>
											</c:choose>		
										</c:when>	
										</c:choose>	
									</c:when>
								</c:choose>	
								<li><a>共${userProjectList.totalPage}页</a></li>
								</ul></div>
					</c:otherwise>
				</c:choose>
			
				
					
			</div>
		</div>
	</div>
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
</body>
</html>
